{
  "cells": [
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "023d771c",
      "metadata": {
        "id": "023d771c"
      },
      "source": [
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pinecone-io/examples/blob/master/docs/quick-tour/hello-pinecone.ipynb) [![Open nbviewer](https://raw.githubusercontent.com/pinecone-io/examples/master/assets/nbviewer-shield.svg)](https://nbviewer.org/github/pinecone-io/examples/blob/master/docs/quick-tour/hello-pinecone.ipynb)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "conceptual-belfast",
      "metadata": {
        "id": "conceptual-belfast",
        "papermill": {
          "duration": 0.028714,
          "end_time": "2021-04-16T15:08:30.639231",
          "exception": false,
          "start_time": "2021-04-16T15:08:30.610517",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "# Hello, Pinecone!\n",
        "\n",
        "This notebook will walk through the steps to get a simple Pinecone index up and running.\n"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "first-affairs",
      "metadata": {
        "id": "first-affairs",
        "papermill": {
          "duration": 0.025469,
          "end_time": "2021-04-16T15:08:30.690710",
          "exception": false,
          "start_time": "2021-04-16T15:08:30.665241",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "## Prerequisites"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "banned-huntington",
      "metadata": {
        "id": "banned-huntington",
        "papermill": {
          "duration": 0.023078,
          "end_time": "2021-04-16T15:08:30.737798",
          "exception": false,
          "start_time": "2021-04-16T15:08:30.714720",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "Install dependencies."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "id": "parallel-detective",
      "metadata": {
        "execution": {
          "iopub.execute_input": "2021-04-16T15:08:30.790085Z",
          "iopub.status.busy": "2021-04-16T15:08:30.789322Z",
          "iopub.status.idle": "2021-04-16T15:08:48.879840Z",
          "shell.execute_reply": "2021-04-16T15:08:48.880935Z"
        },
        "id": "parallel-detective",
        "papermill": {
          "duration": 18.119125,
          "end_time": "2021-04-16T15:08:48.881643",
          "exception": false,
          "start_time": "2021-04-16T15:08:30.762518",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [],
      "source": [
        "!pip install -qU \\\n",
        "  pinecone-client==3.1.0 \\\n",
        "  pandas==2.0.3"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "outer-cartridge",
      "metadata": {
        "id": "outer-cartridge",
        "papermill": {
          "duration": 0.022118,
          "end_time": "2021-04-16T15:08:48.932208",
          "exception": false,
          "start_time": "2021-04-16T15:08:48.910090",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "Set up Pinecone. Get your Pinecone API key [here](https://www.pinecone.io/start)."
      ]
    },
    {
      "cell_type": "markdown",
      "id": "5e8c31e3",
      "metadata": {},
      "source": [
        "Before getting started, decide whether to use serverless or pod-based index."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "da03ecc1",
      "metadata": {},
      "outputs": [],
      "source": [
        "import os\n",
        "\n",
        "use_serverless = os.environ.get(\"USE_SERVERLESS\", \"False\").lower() == \"true\""
      ]
    },
    {
      "cell_type": "markdown",
      "id": "272f3b6d",
      "metadata": {},
      "source": [
        "## Creating an Index\n",
        "\n",
        "Now the data is ready, we can set up our index to store it.\n",
        "\n",
        "We begin by initializing our connection to Pinecone. To do this we need a [free API key](https://app.pinecone.io)."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "3f53fd40",
      "metadata": {},
      "outputs": [],
      "source": [
        "from pinecone import Pinecone\n",
        "\n",
        "# initialize connection to pinecone (get API key at app.pc.io)\n",
        "api_key = os.environ.get('PINECONE_API_KEY') or 'PINECONE_API_KEY'\n",
        "environment = os.environ.get('PINECONE_ENVIRONMENT') or 'PINECONE_ENVIRONMENT'\n",
        "\n",
        "# configure client\n",
        "pc = Pinecone(api_key=api_key)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "eae611ea",
      "metadata": {},
      "source": [
        "Now we setup our index specification, this allows us to define the cloud provider and region where we want to deploy our index. You can find a list of all [available providers and regions here](https://docs.pinecone.io/docs/projects)."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "ca83e5a2",
      "metadata": {},
      "outputs": [],
      "source": [
        "from pinecone import ServerlessSpec, PodSpec\n",
        "\n",
        "if use_serverless:\n",
        "    spec = ServerlessSpec(cloud='aws', region='us-west-2')\n",
        "else:\n",
        "    spec = PodSpec(environment=environment)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "forbidden-indication",
      "metadata": {
        "id": "forbidden-indication",
        "papermill": {
          "duration": 0.020515,
          "end_time": "2021-04-16T15:08:49.925687",
          "exception": false,
          "start_time": "2021-04-16T15:08:49.905172",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "## Pinecone quickstart\n",
        "\n",
        "With Pinecone you can create a vector index where you can store and search through your vectors."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "id": "EA2EcZsCoWS3",
      "metadata": {
        "id": "EA2EcZsCoWS3",
        "tags": [
          "parameters"
        ]
      },
      "outputs": [],
      "source": [
        "# Giving our index a name\n",
        "index_name = \"hello-pinecone\""
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "id": "synthetic-essex",
      "metadata": {
        "execution": {
          "iopub.execute_input": "2021-04-16T15:08:49.974096Z",
          "iopub.status.busy": "2021-04-16T15:08:49.972856Z",
          "iopub.status.idle": "2021-04-16T15:08:50.392796Z",
          "shell.execute_reply": "2021-04-16T15:08:50.391552Z"
        },
        "id": "synthetic-essex",
        "papermill": {
          "duration": 0.446682,
          "end_time": "2021-04-16T15:08:50.393195",
          "exception": false,
          "start_time": "2021-04-16T15:08:49.946513",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [],
      "source": [
        "# Delete the index, if an index of the same name already exists\n",
        "if index_name in pc.list_indexes().names():\n",
        "    pc.delete_index(index_name)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "94LRI2H8Ch2B",
      "metadata": {
        "id": "94LRI2H8Ch2B",
        "papermill": {
          "duration": 0.021764,
          "end_time": "2021-04-16T15:08:50.446400",
          "exception": false,
          "start_time": "2021-04-16T15:08:50.424636",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "Creating a Pinecone Index."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "id": "4YwC8livCrn2",
      "metadata": {
        "execution": {
          "iopub.execute_input": "2021-04-16T15:08:50.497478Z",
          "iopub.status.busy": "2021-04-16T15:08:50.496767Z",
          "iopub.status.idle": "2021-04-16T15:09:04.224132Z",
          "shell.execute_reply": "2021-04-16T15:09:04.223529Z"
        },
        "id": "4YwC8livCrn2",
        "papermill": {
          "duration": 13.756687,
          "end_time": "2021-04-16T15:09:04.224466",
          "exception": false,
          "start_time": "2021-04-16T15:08:50.467779",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [],
      "source": [
        "import time\n",
        "\n",
        "dimensions = 3\n",
        "pc.create_index(\n",
        "    name=index_name, \n",
        "    dimension=dimensions, \n",
        "    metric=\"cosine\",\n",
        "    spec=spec\n",
        ")\n",
        "\n",
        "# wait for index to be ready before connecting\n",
        "while not pc.describe_index(index_name).status['ready']:\n",
        "    time.sleep(1)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "id": "toy-VhU4LO_O",
      "metadata": {
        "execution": {
          "iopub.execute_input": "2021-04-16T15:09:04.283700Z",
          "iopub.status.busy": "2021-04-16T15:09:04.282289Z",
          "iopub.status.idle": "2021-04-16T15:09:05.096982Z",
          "shell.execute_reply": "2021-04-16T15:09:05.096019Z"
        },
        "id": "toy-VhU4LO_O",
        "papermill": {
          "duration": 0.846255,
          "end_time": "2021-04-16T15:09:05.097384",
          "exception": false,
          "start_time": "2021-04-16T15:09:04.251129",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [],
      "source": [
        "index = pc.Index(index_name)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "j1F8SLx6C2HH",
      "metadata": {
        "id": "j1F8SLx6C2HH",
        "papermill": {
          "duration": 0.023037,
          "end_time": "2021-04-16T15:09:05.153116",
          "exception": false,
          "start_time": "2021-04-16T15:09:05.130079",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "We have the index ready. Now we will create some simple vectors that will serve as our examples."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "id": "indirect-lafayette",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 112
        },
        "execution": {
          "iopub.execute_input": "2021-04-16T15:09:05.206498Z",
          "iopub.status.busy": "2021-04-16T15:09:05.205699Z",
          "iopub.status.idle": "2021-04-16T15:09:05.404333Z",
          "shell.execute_reply": "2021-04-16T15:09:05.403743Z"
        },
        "id": "indirect-lafayette",
        "outputId": "5bd49b0e-0187-4de2-e564-1d41c61b7bc9",
        "papermill": {
          "duration": 0.227373,
          "end_time": "2021-04-16T15:09:05.404700",
          "exception": false,
          "start_time": "2021-04-16T15:09:05.177327",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\n",
              "\n",
              "  <div id=\"df-99d57720-4142-46bd-bdc6-feb84fe325ad\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>id</th>\n",
              "      <th>vector</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>A</td>\n",
              "      <td>[1.0, 1.0, 1.0]</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>B</td>\n",
              "      <td>[1.0, 2.0, 3.0]</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-99d57720-4142-46bd-bdc6-feb84fe325ad')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "\n",
              "\n",
              "\n",
              "    <div id=\"df-c9f0274c-90b4-4c4c-b16b-c7dfc421e305\">\n",
              "      <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-c9f0274c-90b4-4c4c-b16b-c7dfc421e305')\"\n",
              "              title=\"Suggest charts.\"\n",
              "              style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "      </button>\n",
              "    </div>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "    background-color: #E8F0FE;\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: #1967D2;\n",
              "    height: 32px;\n",
              "    padding: 0 0 0 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: #E2EBFA;\n",
              "    box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: #174EA6;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "    background-color: #3B4455;\n",
              "    fill: #D2E3FC;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart:hover {\n",
              "    background-color: #434B5C;\n",
              "    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "    fill: #FFFFFF;\n",
              "  }\n",
              "</style>\n",
              "\n",
              "    <script>\n",
              "      async function quickchart(key) {\n",
              "        const containerElement = document.querySelector('#' + key);\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      }\n",
              "    </script>\n",
              "\n",
              "      <script>\n",
              "\n",
              "function displayQuickchartButton(domScope) {\n",
              "  let quickchartButtonEl =\n",
              "    domScope.querySelector('#df-c9f0274c-90b4-4c4c-b16b-c7dfc421e305 button.colab-df-quickchart');\n",
              "  quickchartButtonEl.style.display =\n",
              "    google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "}\n",
              "\n",
              "        displayQuickchartButton(document);\n",
              "      </script>\n",
              "      <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-99d57720-4142-46bd-bdc6-feb84fe325ad button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-99d57720-4142-46bd-bdc6-feb84fe325ad');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "  id           vector\n",
              "0  A  [1.0, 1.0, 1.0]\n",
              "1  B  [1.0, 2.0, 3.0]"
            ]
          },
          "execution_count": 7,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "import pandas as pd\n",
        "\n",
        "df = pd.DataFrame(\n",
        "    data={\n",
        "        \"id\": [\"A\", \"B\"],\n",
        "        \"vector\": [[1., 1., 1.], [1., 2., 3.]]\n",
        "    })\n",
        "df"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "oiJKXWxoDjhK",
      "metadata": {
        "id": "oiJKXWxoDjhK",
        "papermill": {
          "duration": 0.022968,
          "end_time": "2021-04-16T15:09:05.452054",
          "exception": false,
          "start_time": "2021-04-16T15:09:05.429086",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "We perform upsert operations in our index. This call will insert a new vector in the index or update the vector if the id was already present."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "id": "efficient-parliament",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "execution": {
          "iopub.execute_input": "2021-04-16T15:09:05.506668Z",
          "iopub.status.busy": "2021-04-16T15:09:05.505145Z",
          "iopub.status.idle": "2021-04-16T15:09:06.180038Z",
          "shell.execute_reply": "2021-04-16T15:09:06.179012Z"
        },
        "id": "efficient-parliament",
        "outputId": "0d9fbac4-4f8a-421e-95a9-0f441d2dcc16",
        "papermill": {
          "duration": 0.704503,
          "end_time": "2021-04-16T15:09:06.180549",
          "exception": false,
          "start_time": "2021-04-16T15:09:05.476046",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "{'upserted_count': 2}"
            ]
          },
          "execution_count": 8,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "index.upsert(vectors=zip(df.id, df.vector))  # insert vectors"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "id": "enclosed-performer",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "execution": {
          "iopub.execute_input": "2021-04-16T15:09:06.242684Z",
          "iopub.status.busy": "2021-04-16T15:09:06.241999Z",
          "iopub.status.idle": "2021-04-16T15:09:06.350759Z",
          "shell.execute_reply": "2021-04-16T15:09:06.351713Z"
        },
        "id": "enclosed-performer",
        "outputId": "5b67ec13-6863-4b1a-ac45-b57c569923ee",
        "papermill": {
          "duration": 0.140473,
          "end_time": "2021-04-16T15:09:06.352169",
          "exception": false,
          "start_time": "2021-04-16T15:09:06.211696",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "{'dimension': 3,\n",
              " 'index_fullness': 0.0,\n",
              " 'namespaces': {},\n",
              " 'total_vector_count': 0}"
            ]
          },
          "execution_count": 9,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "index.describe_index_stats()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "id": "leading-shape",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "execution": {
          "iopub.execute_input": "2021-04-16T15:09:06.422440Z",
          "iopub.status.busy": "2021-04-16T15:09:06.420935Z",
          "iopub.status.idle": "2021-04-16T15:09:08.564221Z",
          "shell.execute_reply": "2021-04-16T15:09:08.563202Z"
        },
        "id": "leading-shape",
        "outputId": "fb512e95-ebf4-4e1d-b9c7-74afc3cdd0c2",
        "papermill": {
          "duration": 2.177493,
          "end_time": "2021-04-16T15:09:08.564594",
          "exception": false,
          "start_time": "2021-04-16T15:09:06.387101",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "{'matches': [], 'namespace': ''}"
            ]
          },
          "execution_count": 10,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "index.query(\n",
        "    vector=[2., 2., 2.],\n",
        "    top_k=5,\n",
        "    include_values=True) # returns top_k matches"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "z5jcU5_SLMFC",
      "metadata": {
        "id": "z5jcU5_SLMFC",
        "papermill": {
          "duration": 0.035627,
          "end_time": "2021-04-16T15:09:08.629172",
          "exception": false,
          "start_time": "2021-04-16T15:09:08.593545",
          "status": "completed"
        },
        "tags": []
      },
      "source": [
        "## Delete the Index\n",
        "Delete the index once you are sure that you do not want to use it anymore. Once the index is deleted, you cannot use it again."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "id": "indian-broadcast",
      "metadata": {
        "execution": {
          "iopub.execute_input": "2021-04-16T15:09:08.698129Z",
          "iopub.status.busy": "2021-04-16T15:09:08.697250Z",
          "iopub.status.idle": "2021-04-16T15:09:21.171092Z",
          "shell.execute_reply": "2021-04-16T15:09:21.170231Z"
        },
        "id": "indian-broadcast",
        "papermill": {
          "duration": 12.505772,
          "end_time": "2021-04-16T15:09:21.171527",
          "exception": false,
          "start_time": "2021-04-16T15:09:08.665755",
          "status": "completed"
        },
        "tags": []
      },
      "outputs": [],
      "source": [
        "pc.delete_index(index_name)"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.10.10"
    },
    "papermill": {
      "default_parameters": {},
      "duration": 52.201461,
      "end_time": "2021-04-16T15:09:21.730976",
      "environment_variables": {},
      "exception": null,
      "input_path": "/notebooks/quick_tour/hello_pinecone.ipynb",
      "output_path": "/notebooks/tmp/quick_tour/hello_pinecone.ipynb",
      "parameters": {},
      "start_time": "2021-04-16T15:08:29.529515",
      "version": "2.3.3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
